﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.flashsale.ui {
    import flash.display.*;
    import flash.utils.*;
    import Display.DialogUI.*;
    import Classes.util.*;
    import com.zynga.skelly.util.*;

    public class FlashSaleDialog extends GenericDialog {

        public function FlashSaleDialog(_arg1:String, _arg2:String="", _arg3:int=0, _arg4:Function=null, _arg5:String="", _arg6:String="", _arg7:Boolean=true, _arg8:int=0, _arg9:String="", _arg10:Function=null, _arg11:String=""){
            super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11);
        }
        override protected function getAssetDependencies():Array{
            return ([DelayedAssetLoader.GENERIC_DIALOG_ASSETS, DelayedAssetLoader.FLASHSALE_ASSETS]);
        }
        override protected function createAssetDict():Dictionary{
            var _local1:Object = m_assetDependencies[DelayedAssetLoader.FLASHSALE_ASSETS];
            var _local2:Dictionary = new Dictionary();
            _local2["dialog_bg"] = (new _local1.dialog_flashSale_bg() as DisplayObject);
            _local2["icon_cashStack_left"] = (new _local1.icon_cashStack_left() as DisplayObject);
            _local2["icon_cashStack_right"] = (new _local1.icon_cashStack_right() as DisplayObject);
            _local2["loc_heading1"] = ZLoc.t("Dialogs", "FlashSale_heading1");
            _local2["loc_heading2"] = Global.player.name;
            _local2["loc_body1"] = ZLoc.t("Dialogs", "FlashSale_body1");
            _local2["loc_body2"] = ZLoc.t("Dialogs", "FlashSale_body2", {discount:Global.flashSaleManager.getSaleDiscount()});
            _local2["loc_body3"] = this.getBodyTextVariant();
            return (_local2);
        }
        override protected function createDialogView(_arg1:Dictionary):GenericDialogView{
            var _local2:GenericDialogView = new FlashSaleDialogView(_arg1, m_message, m_title, GenericDialogView.TYPE_MODAL, null, "", 0, {listdata:this.getListData()});
            return (_local2);
        }
        protected function getListData():Array{
            return (Global.flashSaleManager.getFeaturedPackages().map(function (_arg1:Object, _arg2:int, _arg3:Array=null):Object{
                _arg1.index = _arg2;
                _arg1.callback = Curry.curry(purchasePackage, _arg1.id);
                return (_arg1);
            }));
        }
        protected function getBodyTextVariant():String{
            if (Global.flashSaleManager.saleVariant > 5){
                return (ZLoc.t("Dialogs", "FlashSale_body3_variantB"));
            };
            return (ZLoc.t("Dialogs", "FlashSale_body3_variantA"));
        }
        protected function purchasePackage(_arg1:int, _arg2=null):void{
            GlobalEngine.socialNetwork.redirect(Global.flashSaleManager.getRedirectUrl(_arg1));
            (this.m_jpanel as GenericDialogView).close();
        }

    }
}//package Modules.flashsale.ui 
